package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.Warehouse;
import com.ruoyi.system.mapper.WarehouseMapper;
import com.ruoyi.system.service.IWarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * 仓库/库区Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-12
 */
@Service
public class WarehouseServiceImpl implements IWarehouseService
{
    @Autowired
    private WarehouseMapper warehouseMapper;

    /**
     * 查询仓库/库区
     * 
     * @param id 仓库/库区主键
     * @return 仓库/库区
     */
    @Override
    public Warehouse selectWarehouseById(Long id)
    {
        return warehouseMapper.selectWarehouseById(id);
    }

    /**
     * 查询仓库/库区列表
     * 
     * @param warehouse 仓库/库区
     * @return 仓库/库区
     */
    @Override
    public List<Warehouse> selectWarehouseList(Warehouse warehouse)
    {
        return warehouseMapper.selectWarehouseList(warehouse);
    }

    /**
     * 新增仓库/库区
     * 
     * @param warehouse 仓库/库区
     * @return 结果
     */
    @Override
    public int insertWarehouse(Warehouse warehouse)
    {
        warehouse.setCreateTime(DateUtils.getNowDate());
        return warehouseMapper.insertWarehouse(warehouse);
    }

    /**
     * 修改仓库/库区
     * 
     * @param warehouse 仓库/库区
     * @return 结果
     */
    @Override
    public int updateWarehouse(Warehouse warehouse)
    {
        warehouse.setUpdateTime(DateUtils.getNowDate());
        return warehouseMapper.updateWarehouse(warehouse);
    }

    /**
     * 批量删除仓库/库区
     * 
     * @param ids 需要删除的仓库/库区主键
     * @return 结果
     */
    @Override
    public int deleteWarehouseByIds(Long[] ids)
    {
        return warehouseMapper.deleteWarehouseByIds(ids);
    }

    /**
     * 删除仓库/库区信息
     * 
     * @param id 仓库/库区主键
     * @return 结果
     */
    @Override
    public int deleteWarehouseById(Long id)
    {
        return warehouseMapper.deleteWarehouseById(id);
    }

    @Override
    public List<Map<String, Object>> CangKuZb() {
        return warehouseMapper.CangkuZb();
    }

    @Override
    public int Cang() {
        return warehouseMapper.Cang();
    }

    @Override
    public int Ku() {
        return warehouseMapper.Ku();
    }


}
